﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.Collections;
using JXT.PrimaryKey.Batman.Domain.Models;
using JXT.PrimaryKey.Batman.Domain.Specifications;

namespace JXT.PrimaryKey.Batman.Domain.Repositories
{
    /// <summary>
    /// 可写存储接口
    /// </summary>
    /// <typeparam name="TEntity">模型类型</typeparam>
    /// <typeparam name="TKey">模型主键类型</typeparam>
    public interface IWriteRepository<TEntity, TKey> : IRepository<TEntity> where TEntity : IEntity
    {
        /// <summary>
        /// 新增模型对象到存储
        /// </summary>
        /// <param name="entity">模型实例</param>
        void Add(TEntity entity);

        /// <summary>
        /// 更新模型对象到存储
        /// </summary>
        /// <param name="entity">模型实例</param>
        void Update(TEntity entity);

        /// <summary>
        /// 从存储删除模型对象
        /// </summary>
        /// <param name="key">模型key</param>
        void Delete(TKey key);
    }
}
